home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / cenvid / controlc.bat < prev    next >
DOS Batch File  |  1995-01-30  |  821b  |  29 lines

  1. @echo off
  2. REM ***************************************************************
  3. REM *** ControlC.bat - Demonstrate control-C handling using the ***
  4. REM *** ver.1          ControlC.lib sample library.             ***
  5. REM ***************************************************************
  6.  
  7. CEnviD %0.bat
  8. GOTO CENVI_EXIT
  9.  
  10. #include <ControlC.lib>
  11.  
  12. printf("Installing CTRL-C/CTRL-BREAK handler...");
  13. InstallBreakHandler();
  14. printf("\nPress any key to display, including Ctrl-C or Ctrl-Break.");
  15. printf("\nExit by pressing ESCAPE...");
  16. for( ; ; ) {
  17.    if ( gCtrlBreak ) {
  18.       printf("\nCONTRL-C OR CTRL-BREAK WERE PRESSED!!!!!\n");
  19.       gCtrlBreak = False;
  20.    } else if ( kbhit() ) {
  21.       printf("%c",key=getch());
  22.       if ( key == '\033' )
  23.          break;
  24.    }
  25. }
  26. RemoveBreakHandler();
  27.  
  28. :CENVI_EXIT
  29.